<!DOCTYPE html>
<html lang="en">
  <head>
    <title>GroupSessionBuilder Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Class/GroupSessionBuilder" class="dashAnchor"></a>
    <a title="GroupSessionBuilder Class Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="../index.html"> Docs</a> (100% documented)</p>
        <p class="header-right"><a href="https://github.com/christophhagen/libsignal-protocol-swift"><img src="../img/gh.png"/>View on GitHub</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="../index.html"> Reference</a>
        <img id="carat" src="../img/carat.png" />
        GroupSessionBuilder Class Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Classes/Fingerprint.html">Fingerprint</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/GroupCipher.html">GroupCipher</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/GroupSessionBuilder.html">GroupSessionBuilder</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SessionBuilder.html">SessionBuilder</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SessionCipher.html">SessionCipher</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/Signal.html">Signal</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SignalAddress.html">SignalAddress</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SignalSenderKeyName.html">SignalSenderKeyName</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SignalStore.html">SignalStore</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Enums.html">Enums</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Enums/SignalError.html">SignalError</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Protocols/IdentityKeyStore.html">IdentityKeyStore</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/PreKeyStore.html">PreKeyStore</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/SenderKeyStore.html">SenderKeyStore</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/SessionStore.html">SessionStore</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/SignedPreKeyStore.html">SignedPreKeyStore</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Structs.html">Structs</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Structs/CiphertextMessage.html">CiphertextMessage</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/CiphertextMessage/MessageType.html">– MessageType</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/KeyPair.html">KeyPair</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/SessionPreKey.html">SessionPreKey</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/SessionPreKeyBundle.html">SessionPreKeyBundle</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/SessionSignedPreKey.html">SessionSignedPreKey</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>GroupSessionBuilder</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">GroupSessionBuilder</span></code></pre>

                </div>
              </div>
            <p>Group session builder is responsible for setting up
group sender key encrypted sessions.</p>

<p>Once a session has been established, <code><a href="../Classes/GroupCipher.html">GroupCipher</a></code>
can be used to encrypt/decrypt messages in that session.</p>

<p>The built sessions are unidirectional: they can be
used either for sending or for receiving, but not both.</p>

<p>Sessions are constructed per (groupId + senderId + deviceId) tuple.
Remote logical users are identified by their senderId, and each
logical recipientId can have multiple physical devices.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14SignalProtocol19GroupSessionBuilderCAcA0A5StoreC2in_tcfc"></a>
                    <a name="//apple_ref/swift/Method/init(in:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:14SignalProtocol19GroupSessionBuilderCAcA0A5StoreC2in_tcfc">init(in:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Constructs a group session builder.</p>

<p>The store and global contexts must remain valid for the lifetime of the
session builder.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="k">in</span> <span class="nv">store</span><span class="p">:</span> <span class="kt"><a href="../Classes/SignalStore.html">SignalStore</a></span><span class="p">)</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>remoteAddress</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The (groupId, senderId, deviceId) tuple</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>store</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The SignalStore to store all state information in</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14SignalProtocol19GroupSessionBuilderC7processyAA17CiphertextMessageV021senderKeyDistributionH0_AA0a6SenderJ4NameC4fromtKF"></a>
                    <a name="//apple_ref/swift/Method/process(senderKeyDistributionMessage:from:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:14SignalProtocol19GroupSessionBuilderC7processyAA17CiphertextMessageV021senderKeyDistributionH0_AA0a6SenderJ4NameC4fromtKF">process(senderKeyDistributionMessage:from:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Construct a group session for receiving messages from senderKeyName.</p>
<div class="aside aside-throws">
    <p class="aside-title">Throws</p>
    Errors of type <code><a href="../Enums/SignalError.html">SignalError</a></code>

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">process</span><span class="p">(</span><span class="n">senderKeyDistributionMessage</span> <span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/CiphertextMessage.html">CiphertextMessage</a></span><span class="p">,</span> <span class="n">from</span> <span class="nv">remoteAddress</span><span class="p">:</span> <span class="kt"><a href="../Classes/SignalSenderKeyName.html">SignalSenderKeyName</a></span><span class="p">)</span> <span class="k">throws</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>message</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A received senderKeyDistributionMessage</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14SignalProtocol19GroupSessionBuilderC7processy10Foundation4DataV28senderKeyDistributionMessage_AA0a6SenderJ4NameC4fromtKF"></a>
                    <a name="//apple_ref/swift/Method/process(senderKeyDistributionMessage:from:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:14SignalProtocol19GroupSessionBuilderC7processy10Foundation4DataV28senderKeyDistributionMessage_AA0a6SenderJ4NameC4fromtKF">process(senderKeyDistributionMessage:from:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Construct a group session for receiving messages from senderKeyName.</p>
<div class="aside aside-throws">
    <p class="aside-title">Throws</p>
    Errors of type <code><a href="../Enums/SignalError.html">SignalError</a></code>

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">process</span><span class="p">(</span><span class="n">senderKeyDistributionMessage</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span> <span class="n">from</span> <span class="nv">remoteAddress</span><span class="p">:</span> <span class="kt"><a href="../Classes/SignalSenderKeyName.html">SignalSenderKeyName</a></span><span class="p">)</span> <span class="k">throws</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>message</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A received senderKeyDistributionMessage</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14SignalProtocol19GroupSessionBuilderC06createD0AA17CiphertextMessageVAA0A13SenderKeyNameC3for_tKF"></a>
                    <a name="//apple_ref/swift/Method/createSession(for:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:14SignalProtocol19GroupSessionBuilderC06createD0AA17CiphertextMessageVAA0A13SenderKeyNameC3for_tKF">createSession(for:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Construct a group session for sending messages.</p>
<li>@param distribution_message a distribution message to be allocated and populated</li>
<div class="aside aside-throws">
    <p class="aside-title">Throws</p>
    Errors of type <code><a href="../Enums/SignalError.html">SignalError</a></code>

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">createSession</span><span class="p">(</span><span class="k">for</span> <span class="nv">localAddress</span><span class="p">:</span> <span class="kt"><a href="../Classes/SignalSenderKeyName.html">SignalSenderKeyName</a></span><span class="p">)</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Structs/CiphertextMessage.html">CiphertextMessage</a></span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>localAddress</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The (groupId, senderId, deviceId) tuple.
In this case, the sender should be the caller</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>The result of the operation, and a sender key distribution message on success</p>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2018 <a class="link" href="https://github.com/christophhagen" target="_blank" rel="external">Christoph Hagen</a>. All rights reserved. (Last updated: 2018-02-20)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
